fix(git): reset sync target to fetched commit#81
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Git synchronization logic in GitLoader to perform a git fetch followed by a git reset --hard FETCH_HEAD instead of a git pull. This change replaces the resetHardToTargetBranch method with a more generic resetHardToRef method and removes the early hard reset before fetching. Additionally, a new test TestGitLoaderSyncResetsDivergedRepository has been added, and existing tests have been updated to reflect the new Git command sequence. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/lgtm |
Replace
git pullwithgit fetchfollowed bygit reset --hard FETCH_HEADfor Git data synchronization.When reusing an existing directory, the loader now aligns the local repository
with the exact fetched remote commit. This prevents failures when local and
remote branches have diverged or when the remote branch history was rewritten.